<template>
    <div>
<h2>用户列表</h2>
<table class="table">
    <tbody>
        <tr>
            <td>用户名</td>
            <td>手机号</td>
            <td>账号</td>
            <td>密码</td>
            <td>所属角色</td>
            <td>创建人</td>
        </tr>



        <tr v-for="item  in list" :key="item.Id">
            <td>{{item.UserName}}</td>
            <td>{{item.Phone.substring(0,3)+'****'+item.Phone.substring(7) }}</td>
            <td>{{item.Name}}</td>
            <td>***</td>
            <td>{{item.RoleName}}</td>
            <td>{{item.CreateName}}</td>
        </tr>
    </tbody>
</table>
    </div>
</template>

<script setup lang="ts">
import { ref,reactive, onMounted } from 'vue';
import { useRoute,useRouter } from 'vue-router';
import axios from 'axios';
const route=useRoute();
const router=useRouter();

//定义显示全局变量
let list:any=ref([]);

onMounted(()=>{
GetuserList();

})

//显示
const   GetuserList=()=>{
axios({
url:'https://localhost:7009/api/User/UserList',
method:'get',
})

.then((res)=>{
console.log(res);
list.value=res.data;
})

.catch((ree)=>{
console.log(ree);
})


}



</script>

<style scoped>

</style>